Hệ thống xếp lịch học tín chỉ cho sinh viên CNTT trên PHP & MySQL
112.226 lượt xem;
1 <!-- Edit this file to change the layout of the detail view form -->
2
3 <a name="detail-view"></a>
4 <div class="panel-heading"><h3 class="panel-title"><strong><%%DETAIL_VIEW_TITLE%%></strong></h3></div>
5
6 <div class="panel-body" id="schools_dv_container">
7 <!-- child links -->
8 <div class="row vspacer-md">
9 <div class="col-xs-12">
10 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="departments_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="departments_link"><i class="glyphicon glyphicon-list-alt"></i> Môn học</a>
11 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="departments_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_departments_link"><i class="glyphicon glyphicon-list-alt"></i> Môn học</a>
12 <input type="hidden" id="departments_hclink" value="departments_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
13 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="class_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="class_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Lịch học</a>
14 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="class_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_class_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Lịch học</a>
15 <input type="hidden" id="class_time_table_hclink" value="class_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
16 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="exam_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="exam_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Lịch thi</a>
17 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="exam_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_exam_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Lịch thi</a>
18 <input type="hidden" id="exam_time_table_hclink" value="exam_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
19 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="student_details_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="student_details_link"><i class="glyphicon glyphicon-list-alt"></i> Thông tin sinh viên</a>
20 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="student_details_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_student_details_link"><i class="glyphicon glyphicon-list-alt"></i> Thông tin sinh viên</a>
21 <input type="hidden" id="student_details_hclink" value="student_details_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
22 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="notices_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="notices_link"><i class="glyphicon glyphicon-list-alt"></i> Thông báo</a>
23 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="notices_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_notices_link"><i class="glyphicon glyphicon-list-alt"></i> Thông báo</a>
24 <input type="hidden" id="notices_hclink" value="notices_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
25 <div class="clearfix"></div>
26 </div>
27 </div>
28 <hr class="hidden-xs hidden-sm">
29
30 <div class="row">
31 <!-- form inputs -->
32 <div class="col-md-8 col-lg-10" id="schools_dv_form">
33 <fieldset class="form-horizontal">
34
35 <div class="form-group">
36 <hr class="hidden-md hidden-lg">
37 <label for="id" class="control-label col-lg-3">ID</label>
38 <div class="col-lg-9">
39 <div class="form-control-static" id="id"><%%VALUE(id)%%></div>
40 </div>
41 </div>
42
43 <div class="form-group">
44 <hr class="hidden-md hidden-lg">
45 <label for="name" class="control-label col-lg-3">Name<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
46 <div class="col-lg-9">
47 <input maxlength="40" type="text" class="form-control" name="name" id="name" value="<%%VALUE(name)%%>" required>
48 </div>
49 </div>
50
51 </fieldset>
52 </div>
53
54 <!-- DV action buttons -->
55 <hr class="hidden-md hidden-lg">
56 <div class="col-md-4 col-lg-2" id="schools_dv_action_buttons">
57 <div class="btn-toolbar_">
58 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
59 <%%UPDATE_BUTTON%%>
60 </div><p></p>
61 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
62 <%%DESELECT_BUTTON%%>
63 <%%DVPRINT_BUTTON%%>
64 <%%DELETE_BUTTON%%>
65 </div><p></p>
66 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
67 <%%INSERT_BUTTON%%>
68 </div>
69 </div>
70 </div>
71 </div>
72
73
74 <!-- child records -->
75 <hr>
76 <div class="row">
77 <div class="col-lg-10 col-lg-offset-1">
78 <div id="schools-children" class="children-tabs"></div>
79 </div>
80 </div>
81
82 </div><!-- /div class="panel-body" -->
83 <script>
84 $j(function() {
85 var add_new_mode = (!$j('input[name=SelectedID]').val());
86 var embedded_mode = ($j('input[name=Embedded]').val() == 1);
87
88 /* auto-close embedded page? */
89 var autoclose_mode = ($j('input[name=AutoClose]').val() == 1);
90 var record_added_ok = (location.search.split('record-added-ok=').length == 2);
91 var record_updated_ok = (location.search.split('record-updated-ok=').length == 2);
92 if((record_added_ok || record_updated_ok) && embedded_mode && autoclose_mode){
93 setTimeout(AppGini.closeParentModal, 2000);
94 }
95
96 /* enable DV action buttons to float on scrolling down the form */
97 enable_dvab_floating();
98
99 if(!(embedded_mode && AppGini.mobileDevice())){
100 $j('select, input[type=text], textarea').not(':disabled').eq(0).focus();
101 }
102
103 $j('form').eq(0).change(function(){
104 if($j(this).data('already_changed')) return;
105 if($j('#deselect').length) $j('#deselect').removeClass('btn-default').addClass('btn-warning').get(0).lastChild.data = " <%%TRANSLATION(Cancel)%%>";
106 $j(this).data('already_changed', true);
107 });
108
109 $j('a[href="<%%TRANSLATION(ImageFolder)%%>"]').click(function(){ /* */ return false; });
110
111 if(embedded_mode){
112 /* hide links to children tables in embedded mode */
113 $j('.detail_view a[id$=_link]').remove();
114
115 /* append embedded mode to all links */
116 var append_embedded = function(){
117 $j('a[href]:not([href^="#"]):not([href^="javascript"]):not([href$="Embedded=1"]):not([href*="link.php?t="]):not([href^="mailto:"])').each(
118 function(){
119 $j(this).attr('href', $j(this).attr('href') + '&Embedded=1');
120 }
121 );
122 }
123 setTimeout(append_embedded, 500);
124 setTimeout(append_embedded, 1500);
125 setTimeout(append_embedded, 2500);
126 setTimeout(append_embedded, 3500);
127 }
128
129 /* when no record is selected ('add new' mode) */
130 if(add_new_mode){
131 /* hide links to children tables */
132 $j('.detail_view a[id$=_link]').remove();
133 }else{
134 post(
135 'parent-children.php', {
136 ParentTable: 'schools',
137 SelectedID: '<%%VALUE(id)%%>',
138 Operation: 'show-children'
139 },
140 'schools-children'
141 );
142 }
143
144 if(!embedded_mode){
145 /* add a horizontal spacer to [add new parent] buttons that don't have a spacered element before them */
146 $j('.add_new_parent').prev(':not(.hspacer-md)').next().addClass('hspacer-md');
147
148 $j('.add_new_parent').click(function(){
149 var pt = $j(this).attr('id').replace(/_add_new$/, '');
150 modal_window({
151 url: pt + '_view.php?addNew_x=1&Embedded=1',
152 close: function(){
153 var field_id = $j('#' + pt + '_add_new').prevAll('input:hidden').eq(0).attr('id');
154 $j('#' + field_id + '-container').select2('focus').select2('focus');
155 },
156 size: 'full',
157 title: $j(this).attr('title')
158 });
159 });
160 }
161
162 AppGini.hideViewParentLinks();
163
164 $j('form').on('click', '.view_parent', function(){
165 var pt = $j(this).attr('id').replace(/_view_parent$/, '');
166 if($j(this).prevAll('input:hidden').length){
167 var parent_id = $j(this).prevAll('input:hidden').eq(0).val();
168 }else{
169 var parent_id = $j(this).prevAll().children('input:hidden').eq(0).val();
170 }
171
172 /* handle radio lookups */
173 if($j(this).prevAll('[type=radio]').length){
174 parent_id = $j(this).prevAll('[type=radio]').eq(0).val();
175 }
176
177 if(parent_id != '{empty_value}' && parent_id != undefined && parent_id != ''){
178 var parent_link = $j(this).parents('.form-group').children('label').data('parent_link');
179 switch(parent_link){
180 case 'view_parent_hidden':
181 break;
182 case 'view_parent_modal':
183 modal_window({
184 url: pt + '_view.php?Embedded=1&SelectedID=' + encodeURIComponent(parent_id),
185 close: function(){
186 var field_id = $j('#' + pt + '_view_parent').prevAll('input:hidden').eq(0).attr('id');
187 $j('#' + field_id + '-container').select2('focus').select2('focus');
188 },
189 size: 'full',
190 title: $j(this).attr('title')
191 });
192 break;
193 case 'view_parent_same_window':
194 window.location = pt + '_view.php?Embedded=' + (embedded_mode ? '1' : '') + '&SelectedID=' + encodeURIComponent(parent_id);
195 break;
196 case 'view_parent_new_window':
197 window.open(pt + '_view.php?SelectedID=' + encodeURIComponent(parent_id));
198 break;
199 }
200
201 }
202 });
203
204
205 /* load admin tools for admin user */
206 if(!add_new_mode){
207 $j('body').append('<div id="admin-tools-appendix"></div>');
208 $j('#admin-tools-appendix').load(
209 'ajax_admin_tools.php?table=schools&id=<%%URLVALUE(id)%%>',
210 function(resp){
211 if(!resp.length) return;
212 $j.ajax('ajax_admin_tools.php?action=get_admin_tools_js&table=schools&id=<%%URLVALUE(id)%%>');
213 }
214 );
215 }
216
217 /* warn user if 'add new' clicked while unsaved changes exist */
218 $j('#addNew').click(function(){
219 if($j('#deselect.btn-warning').length){
220 return confirm('<%%TRANSLATION(discard changes confirm)%%>');
221 }
222 });
223
224 });
225 </script>
2
3 <a name="detail-view"></a>
4 <div class="panel-heading"><h3 class="panel-title"><strong><%%DETAIL_VIEW_TITLE%%></strong></h3></div>
5
6 <div class="panel-body" id="schools_dv_container">
7 <!-- child links -->
8 <div class="row vspacer-md">
9 <div class="col-xs-12">
10 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="departments_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="departments_link"><i class="glyphicon glyphicon-list-alt"></i> Môn học</a>
11 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="departments_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_departments_link"><i class="glyphicon glyphicon-list-alt"></i> Môn học</a>
12 <input type="hidden" id="departments_hclink" value="departments_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
13 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="class_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="class_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Lịch học</a>
14 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="class_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_class_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Lịch học</a>
15 <input type="hidden" id="class_time_table_hclink" value="class_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
16 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="exam_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="exam_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Lịch thi</a>
17 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="exam_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_exam_time_table_link"><i class="glyphicon glyphicon-list-alt"></i> Lịch thi</a>
18 <input type="hidden" id="exam_time_table_hclink" value="exam_time_table_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
19 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="student_details_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="student_details_link"><i class="glyphicon glyphicon-list-alt"></i> Thông tin sinh viên</a>
20 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="student_details_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_student_details_link"><i class="glyphicon glyphicon-list-alt"></i> Thông tin sinh viên</a>
21 <input type="hidden" id="student_details_hclink" value="student_details_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
22 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="notices_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="notices_link"><i class="glyphicon glyphicon-list-alt"></i> Thông báo</a>
23 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="notices_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_notices_link"><i class="glyphicon glyphicon-list-alt"></i> Thông báo</a>
24 <input type="hidden" id="notices_hclink" value="notices_view.php?filterer_school=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
25 <div class="clearfix"></div>
26 </div>
27 </div>
28 <hr class="hidden-xs hidden-sm">
29
30 <div class="row">
31 <!-- form inputs -->
32 <div class="col-md-8 col-lg-10" id="schools_dv_form">
33 <fieldset class="form-horizontal">
34
35 <div class="form-group">
36 <hr class="hidden-md hidden-lg">
37 <label for="id" class="control-label col-lg-3">ID</label>
38 <div class="col-lg-9">
39 <div class="form-control-static" id="id"><%%VALUE(id)%%></div>
40 </div>
41 </div>
42
43 <div class="form-group">
44 <hr class="hidden-md hidden-lg">
45 <label for="name" class="control-label col-lg-3">Name<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
46 <div class="col-lg-9">
47 <input maxlength="40" type="text" class="form-control" name="name" id="name" value="<%%VALUE(name)%%>" required>
48 </div>
49 </div>
50
51 </fieldset>
52 </div>
53
54 <!-- DV action buttons -->
55 <hr class="hidden-md hidden-lg">
56 <div class="col-md-4 col-lg-2" id="schools_dv_action_buttons">
57 <div class="btn-toolbar_">
58 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
59 <%%UPDATE_BUTTON%%>
60 </div><p></p>
61 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
62 <%%DESELECT_BUTTON%%>
63 <%%DVPRINT_BUTTON%%>
64 <%%DELETE_BUTTON%%>
65 </div><p></p>
66 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
67 <%%INSERT_BUTTON%%>
68 </div>
69 </div>
70 </div>
71 </div>
72
73
74 <!-- child records -->
75 <hr>
76 <div class="row">
77 <div class="col-lg-10 col-lg-offset-1">
78 <div id="schools-children" class="children-tabs"></div>
79 </div>
80 </div>
81
82 </div><!-- /div class="panel-body" -->
83 <script>
84 $j(function() {
85 var add_new_mode = (!$j('input[name=SelectedID]').val());
86 var embedded_mode = ($j('input[name=Embedded]').val() == 1);
87
88 /* auto-close embedded page? */
89 var autoclose_mode = ($j('input[name=AutoClose]').val() == 1);
90 var record_added_ok = (location.search.split('record-added-ok=').length == 2);
91 var record_updated_ok = (location.search.split('record-updated-ok=').length == 2);
92 if((record_added_ok || record_updated_ok) && embedded_mode && autoclose_mode){
93 setTimeout(AppGini.closeParentModal, 2000);
94 }
95
96 /* enable DV action buttons to float on scrolling down the form */
97 enable_dvab_floating();
98
99 if(!(embedded_mode && AppGini.mobileDevice())){
100 $j('select, input[type=text], textarea').not(':disabled').eq(0).focus();
101 }
102
103 $j('form').eq(0).change(function(){
104 if($j(this).data('already_changed')) return;
105 if($j('#deselect').length) $j('#deselect').removeClass('btn-default').addClass('btn-warning').get(0).lastChild.data = " <%%TRANSLATION(Cancel)%%>";
106 $j(this).data('already_changed', true);
107 });
108
109 $j('a[href="<%%TRANSLATION(ImageFolder)%%>"]').click(function(){ /* */ return false; });
110
111 if(embedded_mode){
112 /* hide links to children tables in embedded mode */
113 $j('.detail_view a[id$=_link]').remove();
114
115 /* append embedded mode to all links */
116 var append_embedded = function(){
117 $j('a[href]:not([href^="#"]):not([href^="javascript"]):not([href$="Embedded=1"]):not([href*="link.php?t="]):not([href^="mailto:"])').each(
118 function(){
119 $j(this).attr('href', $j(this).attr('href') + '&Embedded=1');
120 }
121 );
122 }
123 setTimeout(append_embedded, 500);
124 setTimeout(append_embedded, 1500);
125 setTimeout(append_embedded, 2500);
126 setTimeout(append_embedded, 3500);
127 }
128
129 /* when no record is selected ('add new' mode) */
130 if(add_new_mode){
131 /* hide links to children tables */
132 $j('.detail_view a[id$=_link]').remove();
133 }else{
134 post(
135 'parent-children.php', {
136 ParentTable: 'schools',
137 SelectedID: '<%%VALUE(id)%%>',
138 Operation: 'show-children'
139 },
140 'schools-children'
141 );
142 }
143
144 if(!embedded_mode){
145 /* add a horizontal spacer to [add new parent] buttons that don't have a spacered element before them */
146 $j('.add_new_parent').prev(':not(.hspacer-md)').next().addClass('hspacer-md');
147
148 $j('.add_new_parent').click(function(){
149 var pt = $j(this).attr('id').replace(/_add_new$/, '');
150 modal_window({
151 url: pt + '_view.php?addNew_x=1&Embedded=1',
152 close: function(){
153 var field_id = $j('#' + pt + '_add_new').prevAll('input:hidden').eq(0).attr('id');
154 $j('#' + field_id + '-container').select2('focus').select2('focus');
155 },
156 size: 'full',
157 title: $j(this).attr('title')
158 });
159 });
160 }
161
162 AppGini.hideViewParentLinks();
163
164 $j('form').on('click', '.view_parent', function(){
165 var pt = $j(this).attr('id').replace(/_view_parent$/, '');
166 if($j(this).prevAll('input:hidden').length){
167 var parent_id = $j(this).prevAll('input:hidden').eq(0).val();
168 }else{
169 var parent_id = $j(this).prevAll().children('input:hidden').eq(0).val();
170 }
171
172 /* handle radio lookups */
173 if($j(this).prevAll('[type=radio]').length){
174 parent_id = $j(this).prevAll('[type=radio]').eq(0).val();
175 }
176
177 if(parent_id != '{empty_value}' && parent_id != undefined && parent_id != ''){
178 var parent_link = $j(this).parents('.form-group').children('label').data('parent_link');
179 switch(parent_link){
180 case 'view_parent_hidden':
181 break;
182 case 'view_parent_modal':
183 modal_window({
184 url: pt + '_view.php?Embedded=1&SelectedID=' + encodeURIComponent(parent_id),
185 close: function(){
186 var field_id = $j('#' + pt + '_view_parent').prevAll('input:hidden').eq(0).attr('id');
187 $j('#' + field_id + '-container').select2('focus').select2('focus');
188 },
189 size: 'full',
190 title: $j(this).attr('title')
191 });
192 break;
193 case 'view_parent_same_window':
194 window.location = pt + '_view.php?Embedded=' + (embedded_mode ? '1' : '') + '&SelectedID=' + encodeURIComponent(parent_id);
195 break;
196 case 'view_parent_new_window':
197 window.open(pt + '_view.php?SelectedID=' + encodeURIComponent(parent_id));
198 break;
199 }
200
201 }
202 });
203
204
205 /* load admin tools for admin user */
206 if(!add_new_mode){
207 $j('body').append('<div id="admin-tools-appendix"></div>');
208 $j('#admin-tools-appendix').load(
209 'ajax_admin_tools.php?table=schools&id=<%%URLVALUE(id)%%>',
210 function(resp){
211 if(!resp.length) return;
212 $j.ajax('ajax_admin_tools.php?action=get_admin_tools_js&table=schools&id=<%%URLVALUE(id)%%>');
213 }
214 );
215 }
216
217 /* warn user if 'add new' clicked while unsaved changes exist */
218 $j('#addNew').click(function(){
219 if($j('#deselect.btn-warning').length){
220 return confirm('<%%TRANSLATION(discard changes confirm)%%>');
221 }
222 });
223
224 });
225 </script>